import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/utils";
import { getBaseUrl } from '@/utils/env'
import { useDownload } from '@/hooks/useDownload'
import modal from '@/hooks/modal'


import '@/assets/styles/oasys.scss'

// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
import ImagePreview from "@/components/ImagePreview/index.vue";
// 文件上传组件
import FileUpload from "@/components/FileUpload"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"

import '@/icons'// icon
// import '@/permission'

if (process.env.NODE_ENV === 'production') {
    const { mockXHR } = require('../mock')
    mockXHR()
}

// 全局方法挂载
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.handleTree = handleTree
Vue.prototype.getBaseUrl = getBaseUrl
Vue.prototype.download = useDownload()
Vue.prototype.$modal = modal


Vue.component('RightToolbar', RightToolbar)
Vue.component('ImagePreview', ImagePreview)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)

Vue.use(ElementUI)
Vue.config.productionTip = false

new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})
